package com.he.architecture.entity;

import com.he.architecture.common.entity.LogicEntity;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.Inheritance;

@Entity
@Getter
@Setter
//如何将继承体系中的类映射到数据库表中
//default InheritanceType.SINGLE_TABLE
@Inheritance
@Where(clause = "is_deleted = 0")
@DiscriminatorColumn(name = "type")
public abstract class User extends LogicEntity {
    @Column
    private String username;
    @Column
    private String password;


    @Column(updatable = false, insertable = false)
    protected Integer type;
}
